from django_filters.filters import *

from apps.clsbb.models import *
from django_filters.rest_framework import FilterSet



class Clsbbfak_RecordsFilter(FilterSet):
    """
    Clsbbfak_Records过滤
    """
    add_time_begin = DateFilter(field_name="add_time",help_text="开始创建时间",lookup_expr="gte")
    add_time_end = DateFilter(field_name="add_time",help_text="结束创建时间",lookup_expr="lte")
    name = CharFilter(field_name="name",help_text="方案名称",lookup_expr="icontains")
    keywords = CharFilter(field_name="keywords",help_text="方案关键词",lookup_expr="icontains")
    class Meta:
        model = Clsbbfak_Records
        fields = ['company','classification','industry',
                  'next_checker','is_effective',
                  'add_time_begin','add_time_end','name','keywords']

class Clsbbalk_RecordsFilter(FilterSet):
    """
    Clsbbalk_Records过滤
    """
    add_time_begin = DateFilter(field_name="add_time",help_text="开始创建时间",lookup_expr="gte")
    add_time_end = DateFilter(field_name="add_time",help_text="结束创建时间",lookup_expr="lte")
    name = CharFilter(field_name="name",help_text="名称",lookup_expr="icontains")
    keywords = CharFilter(field_name="keywords",help_text="关键词",lookup_expr="icontains")
    class Meta:
        model = Clsbbalk_Records
        fields = ['company',
                  'next_checker','is_effective',
                  'add_time_begin','add_time_end','name','keywords']


class Clsbbtbk_RecordsFilter(FilterSet):
    """
    Clsbbtbk_Records过滤
    """
    add_time_begin = DateFilter(field_name="add_time",help_text="开始创建时间",lookup_expr="gte")
    add_time_end = DateFilter(field_name="add_time",help_text="结束创建时间",lookup_expr="lte")
    name = CharFilter(field_name="name",help_text="名称",lookup_expr="icontains")
    keywords = CharFilter(field_name="keywords", help_text="关键词", lookup_expr="icontains")
    class Meta:
        model = Clsbbtbk_Records
        fields = ['company','product','industry',
                  'next_checker','is_effective',
                  'add_time_begin','add_time_end','name','keywords']


class Clsbbcpk_RecordsFilter(FilterSet):
    """
    Clsbbcpk_Records过滤
    """
    add_time_begin = DateFilter(field_name="add_time",help_text="开始创建时间",lookup_expr="gte")
    add_time_end = DateFilter(field_name="add_time",help_text="结束创建时间",lookup_expr="lte")
    name = CharFilter(field_name="name",help_text="名称",lookup_expr="icontains")
    class Meta:
        model = Clsbbcpk_Records
        fields = ['company',
                  'next_checker','is_effective',
                  'add_time_begin','add_time_end','name']


class Clsbbhzhbk_RecordsFilter(FilterSet):
    """
    Clsbbhzhbk_Records过滤
    """
    add_time_begin = DateFilter(field_name="add_time",help_text="开始创建时间",lookup_expr="gte")
    add_time_end = DateFilter(field_name="add_time",help_text="结束创建时间",lookup_expr="lte")
    name = CharFilter(field_name="name",help_text="名称",lookup_expr="icontains")
    class Meta:
        model = Clsbbhzhbk_Records
        fields = ['company',
                  'next_checker','is_effective',
                  'add_time_begin','add_time_end','name']


class Clsbbgszzk_RecordsFilter(FilterSet):
    """
    Clsbbgszzk_Records过滤
    """
    add_time_begin = DateFilter(field_name="add_time",help_text="开始创建时间",lookup_expr="gte")
    add_time_end = DateFilter(field_name="add_time",help_text="结束创建时间",lookup_expr="lte")
    name = CharFilter(field_name="name",help_text="名称",lookup_expr="icontains")
    class Meta:
        model = Clsbbgszzk_Records
        fields = ['company',
                  'next_checker','is_effective',
                  'add_time_begin','add_time_end','name']


class Clsbbryzzk_RecordsFilter(FilterSet):
    """
    Clsbbryzzk_Records过滤
    """
    add_time_begin = DateFilter(field_name="add_time",help_text="开始创建时间",lookup_expr="gte")
    add_time_end = DateFilter(field_name="add_time",help_text="结束创建时间",lookup_expr="lte")
    name = CharFilter(field_name="name",help_text="名称",lookup_expr="icontains")
    class Meta:
        model = Clsbbryzzk_Records
        fields = ['company',
                  'next_checker','is_effective',
                  'add_time_begin','add_time_end','name']



class Clsbb_Common_PdfsFilter(FilterSet):
    """
    Clsbbfak公共pdf过滤
    """
    add_time_begin = DateFilter(field_name="add_time",help_text="开始创建时间",lookup_expr="gte")
    add_time_end = DateFilter(field_name="add_time",help_text="结束创建时间",lookup_expr="lte")
    class Meta:
        model = Clsbb_Common_Pdfs
        fields = ['type','add_time_begin','add_time_end','filled_by']

#
# __all__ =[
#     'Clsbbfak_RecordsFilter',
#     'Clsbbfak_Common_PdfsFilter',
# ]
